//
//  NewWalletHeaderView.m
//  NewPro
//
//  Created by RYX on 2019/4/10.
//  Copyright © 2019 何荧红. All rights reserved.
//

#import "NewWalletHeaderView.h"
#import "IncomeViewController.h"
#import "FanXianViewController.h"
#import "TuiJianViewController.h"
#import "NewWalletModel.h"
#import "TXModel.h"

@interface NewWalletHeaderView()

@property (nonatomic,strong) UIView *xibView;

@property (weak, nonatomic) IBOutlet UILabel *fenrunLa;
@property (weak, nonatomic) IBOutlet UILabel *fenrunTime;

@property (weak, nonatomic) IBOutlet UILabel *fanxianLa;
@property (weak, nonatomic) IBOutlet UILabel *fanxianTime;

@property (weak, nonatomic) IBOutlet UILabel *tuijianLa;
@property (weak, nonatomic) IBOutlet UILabel *tuijianTime;

@end

@implementation NewWalletHeaderView

- (UIView *)xibView{
    
    if (!_xibView) {
    
        _xibView = [[[NSBundle mainBundle] loadNibNamed:@"NewWalletHeaderView" owner:self options:nil] objectAtIndex:0];
    }
    
    return _xibView;
}

- (instancetype)initWithFrame:(CGRect)frame{
    
    if (self = [super initWithFrame:frame]) {
        
        [self setUI:frame];
    }
    
    return self;
}

- (void)setUI:(CGRect)frame{
    
    [self addSubview:self.xibView];
    
    self.xibView.frame = frame;
}

#pragma mark - 分润提现
- (IBAction)onFenRunTiXian:(UIButton *)sender{
    
    IncomeViewController *VC = [[IncomeViewController alloc] init];
    [[self getCurrentViewController].navigationController pushViewController:VC animated:YES];
    
}

#pragma mark - 返现提现
- (IBAction)onFanXianTiXian:(UIButton *)sender{
    
    FanXianViewController *VC = [[FanXianViewController alloc] init];
    [[self getCurrentViewController].navigationController pushViewController:VC animated:YES];
}

#pragma mark - 推荐奖励
- (IBAction)onTuiJianTiXian:(UIButton *)sender {
    
    TuiJianViewController *VC = [[TuiJianViewController alloc] init];
    [[self getCurrentViewController].navigationController pushViewController:VC animated:YES];
}

- (void)setModel:(NewWalletModel *)model{
    
    self.fenrunLa.text = [NSString stringWithFormat:@"%.2f",model.dividedTotal];
    self.fanxianLa.text = [NSString stringWithFormat:@"%.2f",model.returnTotal];
    self.tuijianLa.text = [NSString stringWithFormat:@"%.2f",model.recommendAmount];
}

- (void)setTxModel:(TXModel *)txModel{
    
    self.fenrunTime.text = txModel.tip_devided_time;
    self.fanxianTime.text = txModel.tip_back_time;
    self.tuijianTime.text = txModel.tip_recommend_time;
}
@end
